# coding=gb2312
import redis
from datetime import datetime
        
if __name__ == '__main__':
    redis_svr =  'localhost'
    r = redis.Redis(redis_svr, db=1)
    
    tagnames = r.keys('tag_*')
    start_time = datetime.now()
    pipe = r.pipeline()
    
    for tag in tagnames:
        pipe.hgetall(tag)

        #print tag, '->', r.hgetall(tag)
        
    rs = pipe.execute()
    
    print 'cost', datetime.now()-start_time
    i = 0
    for tag in tagnames:
        print tag, '->' , rs[i]  
        i = i+1

    print 'tag total', len(tagnames)
    